<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>验证码</title>
    </head>
    <script>
        window.onload = function reImg(id) {
            var img = document.getElementById(id);
            img.onclick = function () {
                img.src = "http://localhost:8080/code/" + id + "?" + new Date().getDate();
            }
        }
    </script>
    <body>
        <h3>有干扰线</h3>
        <img src="http://localhost:8080/code/code1" id="code1" onclick="reImg(this.id)" alt="验证码1">
        <h3>无干扰线</h3>
        <img src="http://localhost:8080/code/code2" id="code2" onclick="reImg(this.id)" alt="验证码2">
    </body>
</html>